package summative;

import javax.swing.*;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.util.*;

public class ViewPanel extends JPanel
{

	int x;
	int y;
	int eX;
	int eY;
	VectorFocusList list;
	int type = 1;

	public ViewPanel(VectorFocusList list)
	{
		super();
		setBackground(Color.BLACK);
		setSize(500, 500);
		this.list = list;
	}


	public void paintComponent(Graphics g)
	{
		super.paintComponent(g);
		g.setColor(Color.WHITE);
		
		for(int x = 0; x<700; x+=28)
		{
			g.drawLine(x, 0, x, 1000);
		}
		for(int y = 0; y<1000; y+=25)
		{
			g.drawLine(0, y, 700, y);
		}
		g.fillRect(348, 0, 4, 1000);
		g.fillRect(0, 358, 700, 4);

		
		for(Vector vector: list.getArray())
		{ 
			g.drawLine(vector.getDrawCoordX(), vector.getDrawCoordY(), vector.getDrawCoordXF(), vector.getDrawCoordYF());
		} 
		
	}

	public void updateView()
	{
		repaint();
	}
}